package appapi.utils;

import appapi.entity.Api.HttpQueryEntity;

/**
 * @author djq
 * @date 2023/8/8 10:59
 * @description:
 */
public class SignService {
    public String signData(HttpQueryEntity queryEntity) {
        StringBuilder paramList = new StringBuilder();
        paramList.append("appid=");
        paramList.append(queryEntity.getAppid());
        paramList.append("&data=");
        paramList.append(queryEntity.getData());
        paramList.append("&format=");
        paramList.append(queryEntity.getFormat());
        paramList.append("&method=");
        paramList.append(queryEntity.getMethod());
        paramList.append("&nonce=");
        paramList.append(queryEntity.getNonce());
        paramList.append("&timestamp=");
        paramList.append(queryEntity.getTimestamp());
        paramList.append("&version=");
        paramList.append(queryEntity.getVersion());
        paramList.append("&appsecret=");
        paramList.append(queryEntity.getSecret());
        String signData = paramList.toString().toLowerCase();
        return SignGenerator.signData(signData);
    }
}
